import App from './App.vue'
import uvUI from '@/uni_modules/uv-ui-tools'
import utils from "@/utils/utils";
import apis from "@/apis/index.js";
import shopApis from "@/apis/shop.js";
import globalComponent from "@/utils/globalComponent";
import config from "@/config/index.js";
import pay from "@/utils/pay.js";
import auth from "@/utils/auth.js";
import atlas from "@/utils/atlas.js";

// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
import * as Pinia from 'pinia';

export function createApp() {
	const app = createSSRApp(App)
	app.use(Pinia.createPinia());
	app.use(uvUI);

	// 挂载到全局的每一个Vue实例上
	app.config.globalProperties.$utils = utils
	app.config.globalProperties.$apis = apis
	app.config.globalProperties.$shopApis = shopApis
	app.config.globalProperties.$config = config
	app.config.globalProperties.$pay = pay
	app.config.globalProperties.$auth = auth
	app.config.globalProperties.$atlas = atlas
	// 全局组件挂载
	for (const componentItme in globalComponent) {
		app.component(componentItme, globalComponent[componentItme])
	}
	return {
		app, Pinia
	}
}
// #endif
